<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1" action="<%-- ${systemctx}/sample/saveSample.web --%>" method="post">
	<div class="pageMain">
		<div class="pageTitle">
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascmanagement.title") %>
		<span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.countrymanager.title") %>
		<span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.country.countryList.countrylist") %>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.country.countryList.countrycode") %></label>
						<span><input type="text" class="input-sm" id="countrycode" name="countrycode" value="" /></span>
					</li>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.country.countryList.countryname") %></label>
						<span><input type="text" class="input-sm" id="countryname" name="countryname" value="" /></span>
					</li>
				</ul>
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.country.countryList.description") %></label>
						<span><input type="text" class="input-sm" id="countrydesc" name="countrydesc" value="" /></span>
					</li>
				</ul>
			</div>	
		</div>
		<div class="button-group">
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
			<input type="button" class="btn btn-default" onclick="countryAdd()" value="<%=MessageResourcesUtils.getMessage(request, "common.button.add") %>" />
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
<script type="text/javascript">
	$(document).ready(
			 
					function() {
						//加载分页控件 datagrid
						$('#datagrid').issdatagrid(
										{
											formid : 'form1',
											title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.country.countryList.countrylist") %>',
											width : 'auto',
											nowrap : true,
											autoRowHeight : false,
											singleSelect : true,
											striped : true,
											//collapsible:true,
											url : '${systemctx}/systemmanage/country/queryCountryListInfoDataGrid.json',
											sortName : 'modifytime',
											sortOrder : 'desc',
											remoteSort : true,
											idField : 'id',
											pagination : true,
											rownumbers : true,
											showFooter : true,
											queryParams:$('#form1').serializeObject(),
											columns : [ [{
												field : 'id',
												title : '<%=MessageResourcesUtils.getMessage(request, "common.button.operation") %>',
												width : 90,
												align : 'center',
												formatter : operate
											},{
												title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.country.countryList.countrycode") %>',
												field : 'countrycode',
												width : 100,
												sortable : true,
												align : 'left'
											}, {
												title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.country.countryList.countryname") %>',
												field : 'countryname',
												width : 100,
												sortable : true,
												align : 'left'
											}, {
												title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.country.countryList.description") %>',
												field : 'countrydesc',
												width : 180,
												sortable : true,
												align : 'left'
											} ] ],
											onLoadSuccess : function(data) {

											}
										});

						$('#butQuery').click(
								function() {
									$('#datagrid').datagrid('load',
											$('#form1').serializeObject());
						});

						function operate(val, row) {
							return '<a href="javascript:void(0);" class="easyui-linkbutton" onclick="countryUpdate('
									+ val
									+ ')"><%=MessageResourcesUtils.getMessage(request, "common.button.update") %></a> <a href="javascript:void(0);" class="easyui-linkbutton" onclick="countryDelete('
									+ val + ')"><%=MessageResourcesUtils.getMessage(request, "common.button.delete") %></a> ';
						}

					});
	function countryAdd() {
		$(this).isswindow({
			title : '国家信息-新增',
			noheader : true,
			url : '${systemctx}/systemmanage/country/toAddCountry.web'
		});
	}
	
	function countryUpdate(val) {
		var id = val;
		$(this).isswindow({
			title : '国家信息-修改',
			noheader : true,
			url : '${systemctx}/systemmanage/country/toUpdateCountry.web?id=' + id
		});
	}
	
	function countryDelete(val) {
		var id = val;
		if (confirm("<%=MessageResourcesUtils.getMessage(request, "alertinfo.common.jsp.alert2") %>")) {
			//正在执行...
			showSending();
			$.ajax({
				type : 'GET',
				url : '${systemctx}/systemmanage/country/deleteCountry.json?id=' + id,
				dataType : 'json',
				success : function(data) {
					//关闭执行...
					closeSending();
					//显示AJAX请求后的提示信息
					$.fn.ajaxmessage(data);
					$('#datagrid').datagrid('reload',
							$('#form1').serializeObject());
					$('#datagrid').datagrid('clearSelections');
				}
			});
		}
	}
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>